import request from '@/utils/request.js'
// 封装获取所有角色列表的API
export function getAllRoleAPI (params) {
  return request({
    url: '/sys/role',
    params
  })
}

// 封装根据ID删除角色的API
export function delRoleAPI (id) {
  return request({
    url: '/sys/role/' + id,
    method: 'delete'
  })
}

// 封装添加角色API
export function addRoleAPI (data) {
  return request({
    url: '/sys/role',
    method: 'post',
    data
  })
}

// 封装根据ID获取角色详情的API
export function getRoleDetailAPI (id) {
  return request({
    url: '/sys/role/' + id
  })
}

// 封装根据ID修改角色详情的API
export function updateRoleDetailAPI (data) {
  return request({
    url: '/sys/role/' + data.id,
    data,
    method: 'put'
  })
}

// 封装根据ID更新权限点详情API {id:id(哪个角色下的id),permIds:id(权限id)}

export function updatePermissionByIdAPI (data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
